<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>发布题目</title>

		<link rel="stylesheet" href="../static/Home.CSS">

		<script src="../static/jquery-3.4.1.js"></script>
	</head>
	<body>
		<form action="" method="post">
			<div class="alldiv">
				<div class="description">
					<div>
						<p>请输入题目名称:</p>
						<input type="text" name="name" placeholder="请输入题目名称"/>
					</div>
			
					<div>
						<p>请输入题目类别:</p>
						<input type="text" name="name" placeholder="请输入题目类别"/><br/>
					</div>
				</div>
				<div class="text">
					<p>请输入题目内容:</p>
					<textarea name="context" placeholder="请输入题目内容" style="width: 80%; height: 300px"></textarea>
				</div>

				<div class="attribute" id="testInstance">
					<div>
						<p>测试用例内容:</p>
						<textarea name="testcontext1" placeholder="请输入测试用例内容"></textarea>
					</div>

					<div>
						<p>测试用例结果:</p>
						<textarea name="testrst1" placeholder="请输入测试用例结果"></textarea>
					</div>
				</div>
				
				<div class="button">
					<input id="count" type="hidden" name="count" value="1"/>
					<input id="newTest" type="button" name="addone"  value="增加一个测试用例"/>
					<input type="submit" name="submit" value="提交"/>
				</div>
			</div>
		</form>
		<script>
			window.onload = function(){
				$("#newTest").click(function(){
					document.getElementById("count").value++;
					var value = document.getElementById("count").value;
						$("#testInstance").append("<br/><div><p>测试用例内容</p><textarea name=\"testcontext" + value + '"' + " placeholder=\"请输入测试用例内容\"></textarea></div><div><p>测试用例结果</p><textarea name=\"testrst" + value + '"' + " placeholder=\"请输入测试用例结果\"></textarea></div>");
				});
			}
		</script>
	</body>
</html>
